
const { ccclass, property } = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {

    @property(cc.Node)
    nodeMask: cc.Node = null;

    onLoad() { }

    start() {
        let spriteMask: cc.Sprite = this.nodeMask.getComponent(cc.Sprite);
        let material: cc.Material = spriteMask.getMaterials()[0];
        material.setProperty("radius", 0.08, 0);
        this.node.on(cc.Node.EventType.TOUCH_START, (event) => {
            let pos = this.nodeMask.convertToNodeSpaceAR(event.touch.getLocation());
            material.setProperty("centerPos", [pos.x, pos.y], 0);
        }, this);
        this.node.on(cc.Node.EventType.TOUCH_MOVE, (event) => {
            let pos = this.nodeMask.convertToNodeSpaceAR(event.touch.getLocation());
            material.setProperty("centerPos", [pos.x, pos.y], 0);
        }, this);
    }

    update(dt) {

    }
}
